module Combinators
where
import TITypes
import ParseExpression

i     = parseExp "\\x.x"
k     = parseExp "\\x.\\y.x"
s     = parseExp "\\x.\\y.\\z.((x z) (y z))"
ea    = parseExp "(x (\\y.(y x) \\z.z))"
omega = parseExp "(\\x.(x x) \\x.(x x))"
skk   = App (App s k) k

true  = parseExp "\\t.\\f.t"
false = parseExp "\\t.\\f.f"
test  = parseExp "\\a.\\b.\\c. ((a b) a)"
cbAnd = parseExp "\\a.\\b. ((a b) \\t.\\f.f)"


churchNum :: Int -> Expr
churchNum n = Abs "s" (Abs "z" (rec n))
    where
      rec 0 = Var "z"
      rec n = App (Var "s") (rec (n-1))

add           = parseExp "\\m.\\n.\\s.\\z.((m s) ((n s) z))"
mul           = parseExp "\\m.\\n.\\s.\\z.((m (n s)) z)"
twoPlusThree  = App (App add (churchNum 2)) (churchNum 3)
threeTimesTwo = App (App mul (churchNum 3)) (churchNum 2)
twoTimesThree = App (App mul (churchNum 2)) (churchNum 3)


